from django.http import JsonResponse
from django.shortcuts import render
from django.views import View


class TempView(View):
    def get(self, request):
        data = {
            'movies': [
                '速度9',
                '金刚大战哥斯拉',
                '速度9',
                '金刚大战哥斯拉',
                '速度9',
                '金刚大战哥斯拉',
                '速度9',
                '金刚大战哥斯拉',
            ]
        }
        return render(request, 'index.html', context=data)


class ClassView(View):

    def get(self, request, pk):
        print('路径传参数:', pk)
        print('查询参数:', request.GET)
        print('headers参数:', request.META.get('HTTP_DATE'))

        return JsonResponse({'data': "张三"})
